#region Copyright and License Notice
// Copyright (C)2010-2016 - Rob Levine and other contributors
// http://configgen.codeplex.com
// 
// This file is part of ConfigGen.
// 
// ConfigGen is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// ConfigGen is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License and 
// the GNU Lesser General Public License along with ConfigGen.  
// If not, see <http://www.gnu.org/licenses/>
#endregion

using System;
using System.Collections.Generic;

namespace ConfigGen.ConsoleApp.Core.CommandLineOptionCore
{
    /// <summary>
    /// Interface implemented by factory for providing <see cref="ICommandLineOption{T}"/> instances, 
    /// based on the handler's <see cref="ICommandLineOption{T}.ShortName"/> or <see cref="ICommandLineOption{T}.LongName"/> properties.
    /// </summary>
    /// <typeparam name="T">Type of settings object that is set by the <see cref="ICommandLineOption{T}"/> instances.</typeparam>
    public interface ICommandLineOptionFactory<T>
    {
        /// <summary>
        /// Returns a handler with a corresponding <see cref="ICommandLineOption{T}.LongName"/> to the supplied parameter,
        /// or throws a <see cref="UnrecognisedCommandLineOptionException"/> if no match.
        /// </summary>
        /// <param name="longName">Long name of handler</param>
        /// <returns>Handler corresponding to supplied long name</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="longName"/> is null</exception>
        /// <exception cref="ArgumentException">Thrown if <paramref name="longName"/> is zero length</exception>
        /// <exception cref="UnrecognisedCommandLineOptionException">Thrown if no handler matches the supplied name</exception>
        ICommandLineOption<T> GetByLongName(string longName);


        /// <summary>
        /// Returns a handler with a corresponding <see cref="ICommandLineOption{T}.ShortName"/> to the supplied parameter,
        /// or throws a <see cref="UnrecognisedCommandLineOptionException"/> if no match.
        /// </summary>
        /// <param name="shortName">Short name of handler</param>
        /// <returns>Handler corresponding to supplied short name</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="shortName"/> is null</exception>
        /// <exception cref="ArgumentException">Thrown if <paramref name="shortName"/> is zero length</exception>
        /// <exception cref="UnrecognisedCommandLineOptionException">Thrown if no handler matches the supplied name</exception>
        ICommandLineOption<T> GetByShortName(string shortName);

        /// <summary>
        /// Returns a list of the loaded handlers
        /// </summary>
        IList<ICommandLineOption<T>> LoadedHandlers { get; }
    }
}